import http from '../commons/utils/axios-util';
import HttpUtil from '../commons/utils/http-util';

/**
 * 文件上传
 */
export default class FileUploadApi {
  public static REQUEST_PREFIX = 'communal/fileUpload/';

  /**
   * 上传图片
   * @param params
   */
  static uploadImg(params: any) {
    return http.post(`${FileUploadApi.REQUEST_PREFIX}uploadImg`, params);
  }

  /**
   * 预览图片
   * @param id
   */
  static previewImg(id: string) {
    return HttpUtil.stringUrl(`${FileUploadApi.REQUEST_PREFIX}previewImg`, {
      id,
    });
  }
}
